-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate nullable as type alias and resolve recursive reference in union #2989
Conversation
} | null; | ||
|
||
// @public | ||
export type ErrorModel_1 = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@maorleger this PR can fix the generation error, but it will have duplicate models issue because of this Azure/typespec-azure#1677 (comment) And @tadelesh will fix that after the holiday in tcgc. will you be okay with this fix for now and remove the duplicated models while you prepare the PR ? And we will fix this in emitter side after the holiday.
If you agree with this, I will try to release a new emitter with the current fix before the holiday.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qiaozha thanks for the heads up - this will be fine for me as KeyVault's generated code is not directly exported. We have a convenience layer and can smooth over any duplication as this. Thank you!
|
||
// @public | ||
export type Stop = string | string[]; | ||
export type Prompt_1 = string | string[] | number[] | number[][]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was thinking if we should delivery an alpha verion for keyvalut first. the correct fix without xxx_1 should be non-breaking, but this pr would introduce a breaking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
breaking only exists when there's a real release, and as far as I know keyvault is the only one that has this issue and is going to release, and @maorleger already said they will not release with this duplicate _N suffix. And it seems like an easy fix and can be easily caught during the review stage.
However, any services that are using recursive self reference union would have the same generation crash issue in pipeline. Compare with the generation crash there, we then spend resources to investigate during this period, I prefer to have a new release out with the latest tag.
/cc @joheredi @xirzec Could you kindly keep that in mind while you review the servics onboarding PR? Thanks.
|
||
// @public | ||
export type Stop = string | string[]; | ||
export type Prompt_1 = string | string[] | number[] | number[][]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this because tcgc wrongly tagged this union type as name type but it should be an anoymous one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, see issue here Azure/typespec-azure#2133
// We already know it's not a model type | ||
const variantType = getSchemaForType(dpgContext, variant.type, { | ||
...options, | ||
needRef: isAnonymousModelType(variant.type) ? false : true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it because we change the needRef condition so we fix the max stack issue in RLC? I was just thinking if this is a generic way to fix this and if there is other cases we didn't consider. Can we verify it?
union A {
null,
A
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tcgc has a problem handle the case too Azure/typespec-azure#2132
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to block this but did left some comments, please take a look!
fixes #2993